import request from '@/utils/request'

// 查询项目管理列表
export function listProjectTree(query) {
  return request({
    url: '/project/project/tree/list',
    method: 'get',
    params: query
  })
}

// 查询项目管理详细
export function getProject(projectId) {
  return request({
    url: '/project/project/tree/' + projectId,
    method: 'get'
  })
}

// 查询顶级节点
export function getParentProject(relParentId,isParent) {
  var data ={"relParentId":relParentId,"isParent":isParent};
  return request({
    url: '/project/project/tree/parentTree',
    method: 'get',
    params: data
  })
}

// 新增项目管理
export function addProject(data) {
  return request({
    url: '/project/project',
    method: 'post',
    data: data
  })
}

// 修改项目管理
export function updateProject(data) {
  return request({
    url: '/project/project',
    method: 'put',
    data: data
  })
}

// 删除项目管理
export function delProject(projectId) {
  return request({
    url: '/project/project/' + projectId,
    method: 'delete'
  })
}
// 完成项目管理
// export function completeProject(projectIds,itemIds) {

//   return request({
//     url: '/project/project/approveComplete?projectIds='+projectIds+'&itemIds='+itemIds,
//     method: 'post',
//     data: data
//     })
// }
export function completeProject(projectIds,itemIds) {

  return request({
        url: '/project/project/tree/approveComplete?projectIds='+projectIds+'&itemIds='+itemIds,
    method: 'post'
    })
}
// 导出项目管理
export function exportProject(query) {
  return request({
    url: '/project/project/export',
    method: 'get',
    params: query
  })
}

// 查询项目下拉树结构
export function projectTreeselect(query) {
    return request({
      url: '/project/project/tree/treeselect',
      method: 'get',
      params: query
    })
}

// 获取文件列表
export function selectFiles(projectId) {
  return request({
    url: '/project/project/tree/files/' + projectId,
    method: 'post',
  })
}

// 删除文件列表
export function deleteFiles(ids) {
  return request({
    url: '/system/file/' + ids,
    method: 'delete',
  })
}

// 文件工时
export function listHours(userId) {
  var data = {
    "userId":userId
  }
  return request({
    url: '/work/hours/deptList',
    method: 'post',
    data: data
  })
}